﻿CREATE TABLE [dbo].[SecurityRoleAccess]
(
	[SecurityRoleAccessId] [uniqueidentifier] DEFAULT newid() NOT NULL,
	[Role] [uniqueidentifier] NOT NULL, -- FK to SecurityRole
	[SecurityRole] [uniqueidentifier] NULL, -- FK to SecurityRole
	[Person] [uniqueidentifier] NULL, -- FK to Person
    [Permissions] int DEFAULT 0 NOT NULL, -- CRUD(P)
	[CreatedBy] [uniqueidentifier] NOT NULL, -- FK to Person
	[CreatedOn] [datetime] DEFAULT getdate() NOT NULL,
    [LastChanged] [datetime] DEFAULT getdate() NOT NULL,
	[LastChangedBy] [uniqueidentifier] NOT NULL, -- FK to Person
	[TimeStamp] [timestamp] NOT NULL

CONSTRAINT PK_SecurityRoleAccess PRIMARY KEY CLUSTERED 
(
	[SecurityRoleAccessId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO